package br.edu.ufcg.msnlab2.grupo04.ChebHermLagueLege;

import br.edu.ufcg.msnlab2.InvalidFunctionException;
import br.edu.ufcg.msnlab2.misc.FunctionImpl;

public class LaGuerre {

	private final static double T[] = {
		6.28994508293747919695e+00,    4.15774556783479083309e-01,
		2.29428036027904171980e+00
	};

	private static final double PESOS[] = {
		1.03892565015861357491e-02,    7.11093009929173015457e-01,
		2.78517733569240848792e-01
	};

	private static double integral2 = 0;
	private static FunctionImpl funcao; 

	public static double integralGaussLaGuerre( String func ) throws InvalidFunctionException {
		
		funcao = new FunctionImpl(func);
		
		for (int i = 0; i < 3; i++) {
			integral2 += PESOS[i] * funcao.evaluate(T[i]);
		}

		return integral2;
	}


}
